/*
 * @Author: yokon's 毕业设计
 * @Date: 2020-11-26 20:16:14
 * @LastEditors: yokon
 * @Description: 公共头文件及公共参数
 * @ 再码一行！！！
 */
#ifndef PUBLIC_H
#define PUBLIC_H

#include <fcntl.h>
#include <iostream>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <sys/types.h>
#include <thread>
#include <unistd.h>
#include<time.h>
#include <sstream>
#include <iomanip>
#include<QString>
#include<QVector>

using std::cout;
using std::endl;
using std::string;
const QString shopunit = "27";
const qint8 ishopunid = 27;
#define DEFAULT_PORT_Clie 80
#define DEFAULT_PORT_Http 9000
#define MAX_EVENT_NUM 1024
#define INFTIM -1

#define STR_LEN 20//定义随机输出的字符串长度。
#define CHAR_MIN 'a'
#define CHAR_MAX 'z' //定义输出随机字符串每个字符的最大最小值。

void gettime(char* time);
int chartoint(char *str);
char* strtochar(std::string str, char *an);
int strtoint(std::string str);  
bool searchStr(const char *pSource,const char *pSearch);
void logtotest(string);  //打印日志
void to_hex( char* buff, int buff_len);//16进制打印


//数据类型
const int UPDATE_DATA = 0x01;  //信息更新
const int CHANGE_DATA = 0x02;  //信息更改
const int DEL_DATA    = 0x03;  //信息删除 

const int GET_DATA    = 0x04;  //信息获取

//处理单元
const int UNIT_SHOP_INF = 0x1001; // 店铺信息数据单元(上传更改)
const int UNIT_SHOP_INS = 0x1002; // 店铺信息数据单元（获取）

const int REPONSE_CLIE = 0x5001; // 客户端接收响应状态 1/OK -1/err


const int SHOP_TYPE_BREAKFIRST = 1; //早餐
const int SHOP_TYPE_LUNCH = 2;//午餐
const int SHOP_TYPE_EVET = 3;//晚餐
const int SHOP_TYPE_LUNCH_EVET = 4;//午餐-晚餐
const int SHOP_TYPE_BREAKFIRSH_LUNCH = 5;//早餐-午餐
const int SHOP_TYPE_ALL = 6;//三餐


const int FDS_TYPE_CH = 1;//中餐
const int FDS_TYPE_JP = 2;//日餐
const int FDS_TYPE_USA = 3;//美餐


//网络头
 
struct Nethead{
    int  bonil;       //设备在线状态
    unsigned int iSrcCommID;     //数据类型
    unsigned int iUnitID;       //处理单元
    unsigned int ilenth;       //数据长度
    unsigned int ishopid;       //店铺ID号（必填）
    unsigned int iChick;       //参数校验
    unsigned int iBl;
    char      lParam[10880];         //数据

    Nethead(){
        bonil = -1;
        iSrcCommID = 0;
        iUnitID = 0;
        ilenth = 0;
        iChick =0;
        iBl = 0;
    }
};

 
struct Photo{
unsigned int upLen; //照片长度
char photo[10240]; // 店铺图片
};

//店铺信息
 
struct structshopinf
{
    QString ShopName;
    QString ip;
    QString IsLogin;
    QByteArray photopath;
    QString text;
    QString addr;
    QString PhoneNumber;
    QString shoper;
    QString shoptyp;
    QString fdstype;
};

//菜单
struct mymenu
{
    QString id;
    QString sid;
    QString name;
    QString hot;
    QString minet;
    QString money;
    QString lenth;
    QByteArray photo;
    QString eattype;
    QString type;
};


struct menut{
    QString id;
    QString name;
    QString hot;
    QString minet;
    QString money;
    QString photo;
    QString eattype;
    QString type;
    menut(){
    id = "";
    name= "";
    hot = "";
    minet = "";
    money = "";
    photo = "";
    eattype ="";
    type ="";
    }
};

struct clihnum{
    QString id;
    QString uid;
    QString value;
    QString ischick;
    QString mony;
    QString time;
    QVector<menut> menus;
};




#endif
